﻿Imports System
Imports System.IO.Ports

Partial Public Class WindowSettings

    Private Sub btnSaveSettings_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
        My.Settings.ComPort = cmbCOMPort.SelectedValue
        My.Settings.Save()
        DialogResult = True
    End Sub



    Private Sub populateComPorts()

        Try
            Dim port As String
            For Each port In My.Computer.Ports.SerialPortNames
                cmbCOMPort.Items.Add(port)
            Next
            cmbCOMPort.SelectedValuePath = "Content"
            cmbCOMPort.SelectedValue = My.Settings.ComPort
        Catch ex As Exception
            MsgBox(ex.Message, MsgBoxStyle.Information, )
        End Try
    End Sub


    Public Sub New()

        ' This call is required by the Windows Form Designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        populateComPorts()
    End Sub
End Class
